package com.lagou.demo.controller;

import com.lagou.demo.service.IDemoService;
import com.lagou.mvc.anno.MyAutowired;
import com.lagou.mvc.anno.MyController;
import com.lagou.mvc.anno.MyRequestMapping;
import com.lagou.mvc.anno.MySecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@MyController
@MyRequestMapping("/demo")
@MySecurity({"zhangsan", "lisi"})
public class DemoController {
    @MyAutowired
    private IDemoService demoService;

    /**
     * URL: /demo/query?name=lisi
     *
     * @param request
     * @param response
     * @param name
     * @return
     */
    @MyRequestMapping("/query")
    @MySecurity({"zhangsan"})
    public String query(HttpServletRequest request, HttpServletResponse response, String name) {
        return demoService.get(name);
    }
}
